package com.qdlc.p2p.dal.model;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.qdlc.p2p.common.constant.ChangeCategory;
import com.qdlc.p2p.dal.dto.Tpp;
import com.qdlc.p2p.dal.dto.TppSinaSplit;

/**
 * 接口参数基类
 * 
 * @author wjx
 * @version 2.0
 * @date 2015年6月2日 上午9:31:57
 */
public class TppModel extends Tpp implements Serializable {
	
	/************ 操作状态常量 start *************/
	

	/**
	 * 未处理
	 */
	public final static int STATUS_UNTREATED = 0;
	
	/**
	 * 处理成功
	 */
	public final static int STATUS_SUCEESS = 1;
	
	/**
	 * 处理失败
	 */
	public final static int STATUS_FAIL = 2;
	
	/************ 操作状态常量 end *************/

	/************ 操作类型常量 start *************/
	
	
	/**
	 * 发布借款标
	 */
	public final static String ADDBORROW = "addBorrow";
	
	/**
	 * 投标
	 */
	public final static String ADDTENDER = "addTender";
	
	/**
	 * 申请VIP
	 */
	public final static String APPLYVIP = "applyVip";
	
	/**
	 * 还款
	 */
	public final static String DOREPAY = "doRepay";
	
	/**
	 * 自动还款
	 */
	public final static String AUTOREPAY = "autoRepay";
	
	/**
	 * 网站垫付
	 */
	public final static String ADVANCEREPAY = "advanceRepay";
	
	/**
	 * 借款标复审成功
	 */
	public final static String BORROWVERIFYFULLSUCCESS = "borrowVerifyFullSuccess";
	
	/**
	 * 发布借款标失败
	 */
	public final static String ADDBORROWFAIL = "addBorrowFail";
	
	/**
	 * 借款标取消
	 */
	public final static String BORROWCANCEL = "borrowCancle";
	
	/**
	 * 借款标复审失败
	 */
	public final static String BORROWVERIFYFULLFAIL = "borrowVerifyFullFail";
	
	/**
	 * 发布秒还标冻结
	 */
	public final static String SECONDFREEZE = "secondFreeze";
	
	/**
	 * 发布秒还标解冻
	 */
	public final static String SECONDUNFREEZE = "secondUnFreeze";
	
	/**
	 * 后台充值
	 */
	public final static String WEBRECHARGE = "webRecharge";

	/**
	 * 通过三方订单号退款并处理本地资金
	 */
	public final static String REFUNDBYSUBORDIDY = "refundBySubOrdIdY";
	/**
	 * 通过三方订单号退款不处理本地资金
	 */
	public final static String REFUNDBYSUBORDIDN = "refundBySubOrdIdN";

	/**
	 * 流转标还款
	 */
	public final static String FLOW_REPAY = "flow_repay";
	
	/**
	 * 红包兑换
	 */
	public final static String RED_ENVELOPE_EXCHANGE = "red_envelope_exchange";
	
	/**
	 * 酒券兑换
	 */
	public final static String WINE_COUPONS_EXCHANGE = "wine_coupons_exchange";
	
	/**
	 * 体验金利息
	 */
	public final static String EXPERIENCE_INTEREST = "experience_interest";
	
	/**
	 * 积分抽中现金
	 */
	public final static String SCORE_LOTTERY_MONEY = "score_lottery_money";
	public final static String SCORE_LOTTERY_MONEY_NAME = "积分抽中现金";
	/**
	 * 签到抽中现金
	 */
	public final static String SIGN_LOTTERY_MONEY = "sign_lottery_money";
	public final static String SIGN_LOTTERY_MONEY_NAME = "签到抽中现金";

	/**
	 * 转账
	 */
	public final static String TRANSFER = "转账";

	public final static String BUY_MOVIE_TICKETS_STR = "购买电影票";

	public final static String SELL_MOVIE_TICKETS_STR = "销售电影票";

	/************ 操作类型常量 end *************/
	
	/***********  接口服务类型常量 start ***********/
	/**
	 * 放款
	 */
	public final static String TPP_LOAN = "loan";
	
	/**
	 * 冻结
	 */
	public final static String TPP_FREEZE = "freeze";
	
	/**
	 * 解冻
	 */
	public final static String TPP_UNFREEZE = "unFreeze";
	
	/**
	 * 转账
	 */
	public final static String TPP_TRANSFER = "transfer";
	
	/**
	 * 还款
	 */
	public final static String TPP_REPAY = "repay";
	
	/**
	 * 退款
	 */
	public final static String TPP_REFUND = "refund";
	
	/**
	 * 代收、代付 - 业务名称 (虚拟金代收)
	 */
	public final static String TPP_VIRTUAL = "virtual";


	/***********  接口服务类型常量 end ***********/
	
	/**自动投标Id */
	private long autoTenderId; 
	
	/**
	 * 是否是流转标
	 */
	private  int isFlow;
	
	/** 当前页数 **/
	private int page;
	
	/** 每页总数 **/
	private int rows;
	
	/** 搜索条件：收款方用户名 */
	private String searchName;
	
	/** 开始时间 **/
	private String startTime;
	
	/** 结束时间 **/
	private String endTime;
	
	/**
	 * 付款方用户名
	 */
	private String userName;

	/**
	 * 收款方手机号
	 */
	private String toUserMobile;

	/**
	 * 收款方真实姓名
	 */
	private String toUserRealName;

	/**
	 * 收款方用户名
	 */
	private String toUserName;
	
	/**
	 * 接口操作类型文字描述
	 */
	private String tppTypeStr;
	
	/**
	 * 平台操作类型文字描述
	 */
	private String serviceTypeStr;
	
	/**
	 * 交易状态文字描述
	 */
	private String statusStr;

	/**
	 * 项目总额
	 */
	private double borrowAccount;
	/**
	 * 债权转让model
	 */
	private BondModel bondModel;
	
	/**
	 * 红包金额
	 */
	private double redMoney;
	
	/**
	 * 体验券金额
	 */
	private double experMoney;
	
	/**
	 * 投标标识
	 */
	private String tppBorrowId;
	
	
	/**
	 * 充值方式
	 */
	private int rechargeType;
	/**
	 * 唯一标识
	 */
	private String uuid;

	/**
	 * 银行编号
	 */
	private String bank_code;
	/**
	 * 银行卡属性
	 */
	private String card_attribute;
	/**
	 * 省份
	 */
	private String province;
	/**
	 * 城市
	 */
	private String city;
	
	/**
	 * 第三方系统卡ID
	 */
	private String bank_card_id;
	
	/**
	 * 第三方用户类型
	 */
	private String identityType;
	
	/**
	 * 摘要
	 */
	private String 	summary;
	
	/**
	 * 交易状态码
	 */
	private String out_trade_code;
	
	/**
	 * 支付方式
	 */
	private String pay_method;
	
	/**
	 * 交易失败后 是否可以再次支付 程序默认N
	 */
	private String can_repay_on_failed;
	
	/**
	 * 分账列表
	 */
	private List<TppSinaSplit> split_list;
	
	/**
	 * 扩展参数  参数名1^参数值1|参数名2^参数值2|……
	 */
	private String extendParam;
	
	/**
	 * 新浪备注
	 */
	private String memo;

	/**
	 * 获取实体
	 * @return
	 */
	public Tpp prototype(){
		Tpp tpp = new Tpp();
		BeanUtils.copyProperties(this, tpp);
		return tpp;
	}
	
	/**
	 * 获取model对象
	 * @param tpp
	 * @return
	 */
	public static TppModel instance(Tpp tpp) {
		TppModel model = new TppModel();
		BeanUtils.copyProperties(tpp, model);
		return model;
	}

	public String getTppTypeStr() {
		// 冻结
		if (TppModel.TPP_FREEZE.equals(this.getTppType())) {
			this.tppTypeStr = "冻结";
		}
		// 放款
		if (TppModel.TPP_LOAN.equals(this.getTppType())) {
			this.tppTypeStr = "放款";
		}
		// 还款
		if (TppModel.TPP_REPAY.equals(this.getTppType())) {
			this.tppTypeStr = "还款";
		}
		// 转账
		if (TppModel.TPP_TRANSFER.equals(this.getTppType())) {
			this.tppTypeStr = "转账";
		}
		// 解冻
		if (TppModel.TPP_UNFREEZE.equals(this.getTppType())) {
			this.tppTypeStr = "解冻";
		}
		// 退款
		if (TppModel.TPP_REFUND.equals(this.getTppType())) {
			this.tppTypeStr = "退款";
		}
		// 虚拟金代收
		if (TppModel.TPP_VIRTUAL.equals(this.getTppType())) {
			this.tppTypeStr = "虚拟金代收";
		}
		// 红包兑换
		if (TppModel.RED_ENVELOPE_EXCHANGE.equals(this.getTppType())) {
			this.tppTypeStr = "红包兑换";
		}
		return tppTypeStr;
	}


	public void setTppTypeStr(String tppTypeStr) {
		this.tppTypeStr = tppTypeStr;
	}

	public String getServiceTypeStr() {
		if (TppModel.ADDBORROW.equals(this.getServiceType())) {
			this.serviceTypeStr = "发布借款标";
		}
		if (TppModel.ADDBORROWFAIL.equals(this.getServiceType())) {
			this.serviceTypeStr = "发标失败";
		}
		if (TppModel.ADDTENDER.equals(this.getServiceType())) {
			this.serviceTypeStr = "投标";
		}
		if (TppModel.APPLYVIP.equals(this.getServiceType())) {
			this.serviceTypeStr = "申请VIP";
		}
		if (TppModel.AUTOREPAY.equals(this.getServiceType())) {
			this.serviceTypeStr = "自动还款";
		}
		if (TppModel.BORROWCANCEL.equals(this.getServiceType())) {
			this.serviceTypeStr = "借款标取消";
		}
		if (TppModel.BORROWVERIFYFULLFAIL.equals(this.getServiceType())) {
			this.serviceTypeStr = "借款标复审失败";
		}
		if (TppModel.BORROWVERIFYFULLSUCCESS.equals(this.getServiceType()) || TppModel.TPP_VIRTUAL.equals(this.getServiceType())) {
			this.serviceTypeStr = "借款标复审成功";
		}
		if (TppModel.DOREPAY.equals(this.getServiceType())) {
			this.serviceTypeStr = "还款";
		}
		if (TppModel.RED_ENVELOPE_EXCHANGE.equals(this.getServiceType())) {
			this.serviceTypeStr = "红包兑换";
		}
		if (TppModel.REFUNDBYSUBORDIDY.equals(this.getServiceType())) {
			this.serviceTypeStr = "退款处理本地资金";
		}
		if (TppModel.REFUNDBYSUBORDIDN.equals(this.getServiceType())) {
			this.serviceTypeStr = "退款不处理本地资金";
		}
		return serviceTypeStr;
	}

	public void setServiceTypeStr(String serviceTypeStr) {
		this.serviceTypeStr = serviceTypeStr;
	}


	public String getStatusStr() {
		switch (getStatus()) {
		case TppModel.STATUS_FAIL:
			this.statusStr = "失败";
			break;
		case TppModel.STATUS_SUCEESS:
			this.statusStr = "成功";
			break;
		case TppModel.STATUS_UNTREATED:
			this.statusStr = "未处理";
			break;
		default:
			break;
		}
		return statusStr;
	}


	public void setStatusStr(String statusStr) {
		this.statusStr = statusStr;
	}
	
	
	public int getIsFlow() {
		return isFlow;
	}


	public void setIsFlow(int isFlow) {
		this.isFlow = isFlow;
	}

	public int getPage() {
		return page;
	}


	public void setPage(int page) {
		this.page = page;
	}


	public int getRows() {
		return rows;
	}


	public void setRows(int rows) {
		this.rows = rows;
	}

	public String getSearchName() {
		return searchName;
	}


	public void setSearchName(String searchName) {
		this.searchName = searchName;
	}


	public String getStartTime() {
		return startTime;
	}


	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}


	public String getEndTime() {
		return endTime;
	}


	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}


	public String getUserName() {
		return userName;
	}


	public void setUserName(String userName) {
		this.userName = userName;
	}


	public String getToUserName() {
		return toUserName;
	}


	public void setToUserName(String toUserName) {
		this.toUserName = toUserName;
	}

	public long getAutoTenderId() {
		return autoTenderId;
	}


	public void setAutoTenderId(long autoTenderId) {
		this.autoTenderId = autoTenderId;
	}

	public double getBorrowAccount() {
		return borrowAccount;
	}


	public void setBorrowAccount(double borrowAccount) {
		this.borrowAccount = borrowAccount;
	}


	public double getRedMoney() {
		return redMoney;
	}


	public void setRedMoney(double redMoney) {
		this.redMoney = redMoney;
	}


	public double getExperMoney() {
		return experMoney;
	}


	public void setExperMoney(double experMoney) {
		this.experMoney = experMoney;
	}


	public BondModel getBondModel() {
		return bondModel;
	}


	public void setBondModel(BondModel bondModel) {
		this.bondModel = bondModel;
	}


	public String getTppBorrowId() {
		return tppBorrowId;
	}


	public void setTppBorrowId(String tppBorrowId) {
		this.tppBorrowId = tppBorrowId;
	}

	public int getRechargeType() {
		return rechargeType;
	}


	public void setRechargeType(int rechargeType) {
		this.rechargeType = rechargeType;
	}


	/**
	 * 获取 the uuid
	 * @return 
	 */
	public String getUuid() {
		return uuid;
	}


	/**
	 * 设置 the uuid
	 * @param 
	 */
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}


	public String getBank_code() {
		return bank_code;
	}


	public void setBank_code(String bank_code) {
		this.bank_code = bank_code;
	}


	public String getCard_attribute() {
		return card_attribute;
	}


	public void setCard_attribute(String card_attribute) {
		this.card_attribute = card_attribute;
	}


	public String getProvince() {
		return province;
	}


	public void setProvince(String province) {
		this.province = province;
	}


	public String getCity() {
		return city;
	}


	public void setCity(String city) {
		this.city = city;
	}


	public String getBank_card_id() {
		return bank_card_id;
	}


	public void setBank_card_id(String bank_card_id) {
		this.bank_card_id = bank_card_id;
	}


	/**
	 * 获取 摘要
	 * @return 
	 */
	public String getSummary() {
		return summary;
	}


	/**
	 * 设置 摘要
	 * @param 
	 */
	public void setSummary(String summary) {
		this.summary = summary;
	}


	/**
	 * 获取 扩展参数 参数名1^参数值1|参数名2^参数值2|……
	 * @return 
	 */
	public String getExtendParam() {
		return extendParam;
	}


	/**
	 * 设置 扩展参数 参数名1^参数值1|参数名2^参数值2|……
	 * @param 
	 */
	public void setExtendParam(String extendParam) {
		this.extendParam = extendParam;
	}


	/**
	 * 获取 交易状态码
	 * @return 
	 */
	public String getOut_trade_code() {
		return out_trade_code;
	}


	/**
	 * 设置 交易状态码
	 * @param 
	 */
	public void setOut_trade_code(String out_trade_code) {
		this.out_trade_code = out_trade_code;
	}


	/**
	 * 获取 支付方式
	 * @return 
	 */
	public String getPay_method() {
		return pay_method;
	}


	/**
	 * 设置 支付方式
	 * @param 
	 */
	public void setPay_method(String pay_method) {
		this.pay_method = pay_method;
	}


	/**
	 * 获取  交易失败后 是否可以再次支付 程序默认N
	 * @return 
	 */
	public String getCan_repay_on_failed() {
		return can_repay_on_failed;
	}


	/**
	 * 设置 交易失败后 是否可以再次支付 程序默认N
	 * @param 
	 */
	public void setCan_repay_on_failed(String can_repay_on_failed) {
		this.can_repay_on_failed = can_repay_on_failed;
	}


	/**
	 * 获取 分账列表
	 * @return 
	 */
	public List<TppSinaSplit> getSplit_list() {
		return split_list;
	}


	/**
	 * 设置 分账列表
	 * @param 
	 */
	public void setSplit_list(List<TppSinaSplit> split_list) {
		this.split_list = split_list;
	}


	/**
	 * 获取 the memo
	 * @return 
	 */
	public String getMemo() {
		return memo;
	}


	/**
	 * 设置 the memo
	 * @param 
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}


	/**
	 * 获取 第三方用户类型
	 * @return 
	 */
	public String getIdentityType() {
		return identityType;
	}


	/**
	 * 设置 第三方用户类型
	 * @param 
	 */
	public void setIdentityType(String identityType) {
		this.identityType = identityType;
	}

	public String getToUserMobile() {
		return toUserMobile;
	}

	public void setToUserMobile(String toUserMobile) {
		this.toUserMobile = toUserMobile;
	}

	public String getToUserRealName() {
		return toUserRealName;
	}

	public void setToUserRealName(String toUserRealName) {
		this.toUserRealName = toUserRealName;
	}
}
